package com.example.demo2;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;

@RestController
public class Test {
    @RequestMapping("/r1")
    public String r1(String key){
        return key;
    }
    @RequestMapping("/r2")
    public String r2(String key,Integer value){
        return  key + "=" +value;
    }
    @RequestMapping("/r3")
    public int r3(Integer value){
        return value;
    }

    @RequestMapping("/r4")
    public String r4(Student student){//必须提供无参构造
        return student.toString();
    }
    @RequestMapping("/r5")
    public String r5(String[] arr){//必须提供无参构造
        return Arrays.toString(arr);
    }
    @RequestMapping("/r6")
    public String r6(@RequestParam(required = false) String key){//必须提供无参构造
        return key;
    }

}
